package com.tutorial.springboot.document;

import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * Created by louchen on 2016/11/18.
 */
@Data
@NoArgsConstructor
@Document(indexName = "post", type = "post", shards = 4, replicas = 1)
//shards 主分片,replicas 副本分片
public class Post {

    @Id
    @Field(index = FieldIndex.not_analyzed)
    private String id;

    @Field(index = FieldIndex.analyzed, type= FieldType.String)
    private String title;

    @Field(index = FieldIndex.analyzed, type= FieldType.String, analyzer="ik", searchAnalyzer="ik")
    private String titleCN;

}